﻿using CC.MVC.Models;
using MVC_Intro___Basic_Shapes.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MVC_Intro___Basic_Shapes.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            // In this example, our Model is a square.  It represents the data that we are sending
            // to the Razor rendering engine.

            Square s = new Square(10, 20);

            // We pass the square to the view, in this case, by using the Controller.View function
            // that takes the model as a parameter.  Note that this is a function that 
            // returns a ViewResult and a ViewResult is a child class of ActionResult, so
            // using polymorphism, we can return the ViewResult in this method.

            return View(s);

            /// ACTIVITY: Highlight View above and press F12.  Notice all of the other types that 
            /// are built into the MVC framework so that you can easily return different
            /// content types.  These are all available to us because we inherited from
            /// Controller.
        }

        public ActionResult Circle()
        {            
            /// Same as the Index action, but with a different
            /// shape.  Notice that the _Area partial still works!
            
            Circle cir = new Circle(10);

            return View(cir);

        }

        public ActionResult MultipleShapes()
        {
            MultipleShapesViewModel viewModel = new MultipleShapesViewModel();
            viewModel.Square = new Square(20, 10);
            viewModel.Circle = new Circle(10);

            return View(viewModel);

        }

        
    }


}